package com.wn.ziroom.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.wn.ziroom.entity.Provinces;
import com.wn.ziroom.mapper.ProvincesMapper;
import com.wn.ziroom.service.ProvincesService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Objects;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author wangzhijia
 * @since 2023-02-23 02:27:54
 */
@Service
public class ProvincesServiceImpl extends ServiceImpl<ProvincesMapper, Provinces> implements ProvincesService {

    private ProvincesMapper provincesMapper;

    @Autowired
    public void setProvincesMapper(ProvincesMapper provincesMapper) {
        this.provincesMapper = provincesMapper;
    }

    @Override
    public List<Provinces> showAll() {
        return provincesMapper.selectList(null);
    }

    @Override
    public Provinces findByProName(String provinces) {

        QueryWrapper<Provinces> queryWrapper = new QueryWrapper<>();
        queryWrapper.eq("name",provinces);

        return provincesMapper.selectOne(queryWrapper);
    }
}
